var status = 0;
var eff = "#fUI/UIWindow.img/PvP/Scroll/enabled/next2#";
var z = "#fEffect/CharacterEff/1112905/0/1#";//"+z+"//美化
var eff1 = "#fEffect/CharacterEff/1112905/0/1#";//小红心
var icon = "#fUI/Basic.img/BtMin2/normal/0#";
var iconEvent = "#fUI/UIToolTip.img/Item/Equip/Star/Star#";
var ttt = "#fUI/UIWindow/Quest/icon2/7#";//"+ttt+"//美化1
var ttt2 = "#fUI/UIWindow/Quest/icon6/7#";////美化2
var ttt3 = "#fUI/UIWindow/Quest/icon3/6#";//"+ttt3+"//美化圆
var ttt4 = "#fUI/UIWindow/Quest/icon5/1#";//"+ttt4+"//美化New
var ttt5 = "#fUI/GuildMark.img/Mark/Animal/00002016/15#";////美化!
var ttt6 = "#fUI/UIWindow.img/PvP/Scroll/enabled/next2#";//"+ttt6+"//美化会员
var z1 = "#fUI/UIWindow.img/PvP/Scroll/enabled/next2#";//"+z+"//美化
var tt = "#fUI/Gateway.img/WorldSelect/icon/1#";//音符fEffect/ItemEff/1112811/0/0
var ts = "#fUI/Basic.img/Cursor/18/0#";//shuye
var feng = "#v3015245#";//家族GuildMark.img
var kkk = tt;
var open1 = "#fUI/UIWindow2.img/QuestAlarm/BtQ/normal/0#";//蓝色小Q按钮
var ob1 = "#fEffect/SetEff/102/effect/7#";//PPMS鸟右
var ob2 = "#fEffect/SetEff/102/effect/7#";//PPMS鸟左
var ob3 = "#fEffect/BasicEff.img/Kite/Crown/0#";//皇冠
var ob4 = "#fEffect/OnUserEff.img/PL_AfterLand/hit/0#";//云朵
var ob5 = "#fEffect/OnUserEff.img/PL_RocketEgg/clear/3#";//火箭人
var ob6 = "#fEffect/SetEff.img/181/effect/walk1/2#";//狗拉车
var ob7 = "#fEffect/SetEff.img/250/effect/17#";//鲜花飞鸟
var ob8 = "#fUI/UIWindow2.img/AdditionalOptionTooltip/epic#";//小紫色按钮a
var ob9 = "#fUI/UIWindow2.img/AdditionalOptionTooltip/rare#";//小紫色按钮b
var ob10 = "#fUI/UIWindow2.img/AdditionalOptionTooltip/unique#";//小紫色按钮s
var ob11 = "#fUI/UIWindow2.img/AdditionalOptionTooltip/legendary#";//小紫色按钮ss
var ob12 = "#fUI/UIWindow2.img/AttackRangking/1#";//小皇冠
var ob13 = "#fUI/UIWindow2.img/CN_Santa/backgrnd#";//长条
var ob14 = "#fUI/UIWindow2.img/Item/timeLimit/0#";//小闹钟
var ob15 = "#fUI/UIWindowString.img/Zero_Weapon/Bt_Wp/normal/0#";//wp
var F111 = "#fUI/NameTag.img/128/w#";//小黄鸭戒指头部、
var F112 = "#fUI/NameTag.img/128/c#";//小黄鸭戒指中间部分
var F113 = "#fUI/NameTag.img/128/e#";//小黄鸭戒指中间尾部
var F114 = "#fUI/NameTag.img/157/w#";//小兔子戒指头部、
var F115 = "#fUI/NameTag.img/157/c#";//小兔子戒指中间部分
var F116 = "#fUI/NameTag.img/157/e#";//小兔子戒指中间尾部
var F117 = "#fUI/RunnerGame.img/RunnerGameUI/UI/Point/1#";//左上角枫叶
var F118 = "#fUI/UIWindow4.img/bossArena/mainUi/bossIcon/0#";//迷你女皇
var F119 = "#fUI/UIWindow4.img/bossArena/mainUi/bossIcon/1#";//迷你女皇
var F120 = "#fUI/UIWindow4.img/bossArena/mainUi/bossIcon/2#";//迷你女皇
var F121 = "#fUI/UIWindow4.img/bossArena/mainUi/bossIcon/3#";//迷你女皇
var F122= "#fUI/UIWindow4.img/bossArena/mainUi/bossIcon/4#";//迷你女皇
var F123 = "#fUI/UIWindow4.img/bossArena/mainUi/bossIcon/5#";//迷你女皇
var bobo1 = "#fUI/GuildBBS.img/GuildBBS/Emoticon/Basic/0#";//迷你笑脸
var bobo2 = "#fUI/GuildBBS.img/GuildBBS/Emoticon/Basic/1#";//迷你愁脸
var bobo3 = "#fUI/GuildBBS.img/GuildBBS/Emoticon/Basic/2#";//迷你开心
var bobo4 = "#fUI/GuildBBS.img/GuildBBS/Emoticon/Cash/0#";//迷你生气
var bobo5 = "#fUI/GuildBBS.img/GuildBBS/Emoticon/Cash/1#";//迷你猥琐笑
var bobo6 = "#fUI/GuildBBS.img/GuildBBS/Emoticon/Cash/2#";//迷你闭嘴
var bobo7 = "#fUI/GuildBBS.img/GuildBBS/Emoticon/Cash/3#";//迷你开怀大笑
var bobo8 = "#fUI/GuildBBS.img/GuildBBS/Emoticon/Cash/4#";//迷你目瞪口呆
var bobo9 = "#fUI/GuildBBS.img/GuildBBS/Emoticon/Cash/5#";//迷你哭泣
var bobo10 = "#fUI/GuildBBS.img/GuildBBS/Emoticon/Cash/6#";//迷你凶恶
var bobo11 = "#fUI/GuildBBS.img/GuildBBS/Emoticon/Cash/7#";//迷你惊吓
var jzs1 = "#fUI/GuildMark.img/Mark/Animal/00002016/15#";//家族小兔子白
var jzs4 = "#fUI/GuildMark.img/Mark/Animal/00002016/12#";//家族小兔子灰蓝
var jzs5 = "#fUI/GuildMark.img/Mark/Animal/00002016/13#";//家族小兔子紫
var jzs6 = "#fUI/GuildMark.img/Mark/Animal/00002016/14#";//家族小兔子紫
var jzs7 = "#fUI/GuildMark.img/Mark/Animal/00002016/9#";//家族小兔子紫
var jzs8 = "#fUI/GuildMark.img/Mark/Animal/00002016/2#";//家族小兔子紫
var jzs9 = "#fUI/GuildMark.img/Mark/Animal/00002016/5#";//家族小兔子紫
var jzs10 = "#fUI/GuildMark.img/Mark/Animal/00002016/3#";//家族小兔子紫
var jzs2 = "#fUI/GuildMark.img/Mark/Animal/00002002/15#";//家族小兔子
var jzs3 = "#fUI/GuildMark.img/Mark/Plant/00003002/8#";//家族小兔子
var menuList = Array(
        Array(ttt5,"藏身地图", 1, true),//false关闭活动
        Array(ttt5,"藏身地图", 2, true),
	    Array(ttt5,"藏身地图", 3, true),
	    Array(ttt5,"藏身地图", 4, true),
	    Array(ttt5,"藏身地图", 5, true),
	    Array(ttt5,"藏身地图", 6, true),
	    Array(ttt5,"藏身地图", 7, true),
	    Array(ttt5,"藏身地图", 8, true),
	    Array(ttt5,"藏身地图", 9, true),
		Array(ttt5,"藏身地图", 10, true),
	    Array(ttt5,"藏身地图", 11, true),
	    Array(ttt5,"藏身地图", 12, true)




        );
//图片特效,名字，selection，是否显示

var npcid = Array(9000316, 9001142,9001000,9001002);

function start() {
    status = -1;
    action(1, 0, 0);
}

function action(mode, type, selection) {
    if (status == 0 && mode == 0) {
        cm.dispose();
        return;
    }
    if (mode == 1) {
        status++;
    } else {
        status--;
    }
    if (cm.getMapId() == 180000001) {
        cm.sendOk("很遗憾，您因为违反用户守则被禁止游戏活动，如有异议请联系管理员.")
        cm.dispose();
    } else if (status == 0) { //
        var selStr ="#r#ePPMS冒险岛的管理员就藏在下面这些地图内快点进捉到他吧\r\n";
		var x = 0;
        for (var i = 0; i < menuList.length; i++) {
            if (menuList[i][3]) { // 如果允许显示
                x++;
                selStr += "#b#L" + menuList[i][2] + "#" + menuList[i][0] + " " + (menuList[i][2] == 22 && cm.isQuestFinished(1465) ? "玩家转职" : menuList[i][1]) + "#l";

                if (x % 3 == 0) {
                    selStr += "\r\n";
                } else {
                    selStr += " ";
                }
				if (menuList[i][2] == 22) {
					selStr
				}
            }

        }

        if (x % 3 != 0) {
            selStr += "\r\n";
        }
        selStr += " ";
	    selStr += " ";
        cm.sendSimple(selStr, npcid[Math.floor(Math.random() * npcid.length)]);
    } else if (status == 1) {
        switch (selection) {
            case 0: // 返回市场
                if (cm.getPlayer().getMapId() >= 910000000 && cm.getPlayer().getMapId() <= 910000022) {
                    cm.sendOk("#fs28##fn方正舒体##b您已经在自由市场了！", npcid[Math.floor(Math.random() * npcid.length)]);
                } else {
                    cm.saveReturnLocation("FREE_MARKET");
                    cm.warp(910000000, "st00");
                }
                cm.dispose();
                break;
            case 1: // 漂浮山
				cm.dispose();
				cm.warp(993000886);
				return;
            case 2: // 特快列车
				cm.dispose();
				cm.warp(867119900);
				return;
            case 3: // 陷阱跑步机
				cm.dispose();
				cm.warp(800022430);
				return;
			case 4://宇宙魔方
        	    cm.dispose();
				cm.warp(867110000);
				return;
            case 5: //  十周年地图
        	    cm.dispose();
				cm.warp(706040000);
				return;
            case 6: //  野外
        	    cm.dispose();
				cm.warp(867000008);
				return;
            case 7: //  野外
        	    cm.dispose();
				cm.warp(867000013);
				return;
            case 8: //  潜水艇
        	    cm.dispose();
				cm.warp(914200000);
				return;
            case 9:  //  高的很
        	    cm.dispose();
				cm.warp(911002100);
				return;
            case 10: //  免费会员101050100
        	    cm.dispose();
				cm.warp(101050100);
				return;
            case 11: //  PPMS福利 每日抽奖  每日许愿  每日签到  免费造型224000060
        	    cm.dispose();
				cm.warp(224000060);
				return;
            case 12: //  个人乱斗
        	    cm.dispose();
				cm.warp(323090230);
				return;
            case 13: //  红包系统
                cm.dispose();
                cm.openNpc(9300011, "红包系统");
                break;
            case 14: //  分身系统
                cm.dispose();
                cm.openNpc(9900003, "xuegoujineng");
                break;
            case 15: //  结婚系统
                cm.sendOk(payStr);
                cm.dispose();
                break;
            case 16: //  五转矩阵
	                cm.openUI(1131);
                break;
            case 17: //  神秘徽章任务
                cm.dispose();
                cm.openNpc(2140001,"神秘徽章");
                break;
            case 18://排行系统
                cm.dispose();
                cm.warp(0,"排名系统");
                break;
            case 19://赞助送礼
                cm.dispose();
                cm.openNpc(0, "赞助送礼");
                break;
            case 20://拓展功能
                cm.dispose();
                cm.openNpc(9310106, "拓展功能");
                break;
            case 21:
                cm.dispose();
                cm.openNpc(1092017);
                break;
            case 1000:
                cm.dispose();
                cm.EnterCS();
                break;
            case 1001:
                //cm.openWeb("http://www.ddmxdsf.cn");
                cm.dispose();
                break;
            case 84841:
				cm.dispose();
                cm.openNpc(9130115);
                break;
            case 998:
				cm.dispose();
                cm.openNpc(0, "红包系统");
                break;
            case 88881:
				cm.dispose();
                cm.openNpc(0, "点卷购物");
                break;
            case 999:
				cm.dispose();
                cm.openNpc(0, "功能扩展");
                break;
			 case 867761:
				cm.dispose();
                cm.openNpc(0, "抵用卷商城");
                break;
			default:
                cm.dispose();
                cm.sendOk("本活动持续7轮：选择你觉得gm可能会藏身的地图，第一个进去的玩家会被gm奖励道具~（活动结束后管理员会主动找你发送奖励）\r\n第一轮奖励：#v1102784#\r\n第二轮奖励：#v1102780#\r\n第三轮奖励：#v1102781#\r\n第四轮奖励：#v1102782#\r\n第五轮奖励：#v1102783#\r\n第六轮奖励：#v1102785#\r\n第七轮奖励：#v1102786#");
				break;
        }
    }
}


function ListFor(type) {
    var x = 0;
    var space = "";
    if (type >= 3)
        space = "  ";
    for (var i = 0; i < List.length; i++) {
        if (List[i][2] == type) {
            if (x == 3) {
                text += "#L" + i + "#" + List[i][0] + "#l\r\n";
                x = 0;
            } else {
                text += "#L" + i + "#" + List[i][0] + "#l" + space;
                x++;
            }
        }
    }
}